package com.dd.manyteacherhall.customer;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.daimajia.slider.library.SliderTypes.BaseSliderView;
import com.dd.manyteacherhall.R;
import com.squareup.picasso.Picasso;

/**
 * Created by yx on 2017/7/11.
 */

public class CustomSliderView extends BaseSliderView {
    public CustomSliderView(Context context) {
        super(context);
    }

    @Override
    public View getView() {//设置底部指针背景透明
        View v = LayoutInflater.from(getContext()).inflate(R.layout.item_slider_view, null);
        ImageView target = (ImageView) v.findViewById(R.id.daimajia_slider_image);
        TextView description = (TextView) v.findViewById(R.id.description);
        description.setText(getDescription());
        bindEventAndShow(v, target);
        return v;
    }

    @Override
    protected void bindEventAndShow(View v, ImageView targetImageView) {//设置圆角
        super.bindEventAndShow(v, targetImageView);
        targetImageView.setScaleType(ImageView.ScaleType.FIT_XY);
        Picasso.with(getContext()).load(getUrl()).transform(new PicassoRoundTransform()).into(targetImageView);
        v.findViewById(R.id.loading_bar).setVisibility(View.INVISIBLE);
    }
}
